import Ajax from './customajax'

export default {
    listHostgroup() {
        const url = '/dirms/monitor/group/list';
        return Ajax.save(url);
    },
    queryHostByGroupid(groupid) {
        const url = '/dirms/monitor/host/get/' + groupid;
        return Ajax.save(url);
    },
    queryGraphByHostid(hostid) {
        const url = '/dirms/monitor/graph/getByHostid';
        return Ajax.save(url, { hostid: hostid });
    },
    queryItemByGraphid(graphid) {
        const url = '/dirms/monitor/item/getByGraphId/' + graphid;
        return Ajax.save(url);
    },
    queryAllHostgroup() {
        const url = '/dirms/monitor/group/all';
        return Ajax.save(url);
    },
    createHost(host) {
        const url = '/dirms/monitor/host/create';
        return Ajax.save(url, host);
    },
    queryTrendByItemid(itemid, timefrom, timeto) {
        const url = '/dirms/monitor/trend/get/' + itemid + '/' + timefrom + '/' + timeto;
        return Ajax.save(url);
    },
    queryByItemid(itemid) {
        const url = '/dirms/monitor/item/getItem/' + itemid;
        return Ajax.save(url);
    },
    updateItemProperties(itemid, keys, values) {
        const url = '/dirms/monitor/item/update/' + itemid;
        return Ajax.save(url, { attributeNames: keys.join(','), attributeValues: values.join(',') });
    },
    updateTriggerProperties(itemid, keys, values) {
        const url = '/dirms/monitor/trigger/update/' + itemid;
        return Ajax.save(url, { attributeNames: keys.join(','), attributeValues: values.join(',') });
    },
    deleteHostByIds(hostIds) {
        const url = '/dirms/monitor/host/delete/ids';
        return Ajax.save(url, { ids: hostIds });
    },
    deleteGraphByIds(graphIds) {
        const url = '/dirms/monitor/graph/delete/ids/';
        return Ajax.save(url, { ids: graphIds });
    },
    deleteHostgroupByIds(hostGroupIds) {
        const url = '/dirms/monitor/group/delete/ids/';
        return Ajax.save(url, { ids: hostGroupIds });
    },

}